package com.cc.app;

import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Spinner;

import com.cc.app.module.ImageSoures;
import com.cc.app.ui.MainView;
import com.cc.app.util.Utils;

public class MainActivity extends AppCompatActivity {

    private Spinner spinner;

    private MainView mainView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        initListener();
    }

    private void initView() {
        mainView = findViewById(R.id.surface);
        spinner = findViewById(R.id.modeSpinner);

        for (int i = 0; i < ImageSoures.imageSours.length; i++) {
            Bitmap bitmap = Utils.readBitmap(getApplicationContext(), ImageSoures.imageSours[i], 1);
            mainView.addImage(bitmap);
        }
    }

    private void initListener() {
        spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                if (position == 0) {
                } else {
                }
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {

            }
        });
    }

    public void orderMode(View view) {
    }


}
